package com.ebei.common.web;

import com.ebei.common.util.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * todo Controller层基类
 *
 * @author crazypenguin, fbb
 * @version 1.0
 * @created 2018/4/17
 * @last 2018/5/14
 */
@Controller
public class BaseController {

    @Autowired
    private HttpServletRequest request;
    protected org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(this.getClass());

    /**
     * 根据请求heard中的token获取用户角色
     *
     * @return 角色名
     */
    public List<String> getRole() {
        return UserUtils.getRole(request);
    }

}
